package com.test.amqp;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * 一个消息消费者
 */
@Component
public class TopicReceiver {

    @RabbitListener(queues = "topic1")
    public void handler(String msg) {
        int i = 0;
        while (i < 20) {
            i++;
        }
        System.out.println("TopicReceiver:------1111 " + msg);
    }

    @RabbitListener(queues = "topic2")
    public void handler2(String msg) {
        int i = 0;
        while (i < 20) {
            i++;
        }
        System.out.println("TopicReceiver:------222 " + msg);
    }

    @RabbitListener(queues = "topic3")
    public void handler3(String msg) {
        int i = 0;
        while (i < 20) {
            i++;
        }
        System.out.println("TopicReceiver:------3333 " + msg);
    }
}
